// SPDX-License-Identifier: GPL-2.0
/*
 * CPP: STATIC_CAST
 *
 * (C) 2024.05.24 BiscuitOS <buddy.zhang@aliyun.com>
 */
#include <iostream>
#include <string.h>

using namespace std;

/* BASIC CLASS */
class PERSON {
public:
	/* METHOD */
	virtual void show() {
		std::cout << "BASE CLASS" << std::endl;
	}
};

/* DERIVED CLASS */
class STUDENT : public PERSON {
public:
	/* METHOD */
	void show() override {
		std::cout << "DERIVED CLASS" << std::endl;
	}
};

int main(void) {
	/* CREATE OBJECT */
	PERSON *p = new STUDENT();
	STUDENT *sp = static_cast<STUDENT *>(p);

	/* INVOKE METHOD */
	sp->show();

	/* BASIC TYPE */
	int i = 10;
	double d = static_cast<double>(i);

	std::cout << d << std::endl;

	/* RECLAIM */
	delete p;

	return 0;
}
